<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="description" content=""/>
    <meta name="keywords" content=""/>
    <meta name="author" content="Flying hormone"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Access-Control-Allow-Origin" content="http://47.92.124.33/jrkj/">
    <link rel="stylesheet" href="css/mui.min.css"/>
    <link rel="stylesheet" href="css/media.css"/>
    <link rel="stylesheet" href="css/base.css"/>
    <link rel="stylesheet" href="css/all.css"/>

    <script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
    <script type="text/javascript" src="js/mui.min.js"></script>
    <script type="text/javascript" src="js/http.js"></script>
    <script type="text/javascript" src="js/loading.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
    <title>学戏</title>
    <script>
        function logout(){
            $.ajax({
                url:url+'logout',
                dataType:'json',
                type:'post',
                async:true,
                data:{

                },
                success:function(result){
                    // console.log(result);
                    var status = result.status;
                    var code = result.code;
                    var data = result.data;
                    var html='';
                    if(status==1&&code=='1000') {
                        alert(data);
                        window.location.reload();
                    }else{

                    }
                },
                error:function(){
                    console.log();
                }
            })
        }
        $(function(){
            $('.juMeun').css('display','none');
            $('#toregister').attr('href',yuming+"/register.html");
            var typeall='';
            //城市下拉
            var arr = (decodeURI(location.hash) || "").replace(/^\#/,'').split("&");
            $(".cityname").html(arr[0]||"扬州");

            function checklogin(){
                $.ajax({
                    url:url+'checkloginis',
                    dataType:'json',
                    type:'post',
                    async:true,
                    data:{

                    },
                    success:function(result){
                        // console.log(result);
                        var status = result.status;
                        var code = result.code;
                        var data = result.data;
                        var html='';
                        if(code=='1007') {
                            //html='<a class="right_teacher login-btn" href="#">'+data['xingming']+'</a><a class="right_teacher logout"  href="javascript:logout();">退出</a> <a class="right_teacher " href="approve.html">认证信息</a>';
                            html='  <a class="btns_left " href="city.html">北京<i class="mui-icon mui-icon-arrowdown"></i></a>'+
                                    '    <a class="btns_right" href="">'+data['xingming']+'</a>'+
                                    '    <a class="btns_right " href="javascript:logout();">退出</a>'+
                                    '    <a class="btns_right " id="personalcenter" href="javascript:void(0)">个人中心</a>'+
                                    '    <a class="btns_right" href="approve.html">认证信息</a>';
                            $('#btns').html(html);
                            $('.logout').on('click',function(){
                                logout();
                            });
                            $('#personalcenter').on('click',function(){
                                checlogins();
                            });
                        }else if(status==1&&code=='1009'){
                            bangdingusername();
                            // window.location.href=yuming+'/register.html';
                        }else if(status==1&&code=='1010'){
                            mui.alert('提示', '登录过期', function() {});
                        }
                    },
                    error:function(){
                        console.log();
                    }
                })
            }

            $('.login-btn').on('click',function(){
                $('#weixinhref').attr('href',domain+'api/jiajiao/Weixin/index');
                $('#weixinsrc').attr('src',domain+'/qqjj/images/weixin.jpg');
                $("#login").show();
            });
            $('#loginsure').on('click',function(){
                var username = $('#username').val();
                var password = $('#password').val();
                if(null==username || ""==username){
                    mui.alert('提示', '用户名不能为空', function() {});
                    return;
                }
                if(null==password || ""==password){
                    mui.alert('提示', '密码不能为空', function() {});
                    return;
                }
                var type = $(".type").val();
                sessionStorage.setItem('type',type);
                $.ajax({
                    url:url+'login',
                    dataType:'json',
                    type:'post',
                    async:true,
                    data:{
                        'username':username,
                        'password':password,
                        'flag':type
                    },
                    success:function(result){
                        // console.log(result);
                        var status = result.status;
                        var code = result.code;
                        var data = result.data;
                        var html='';
                        if(status==1&&code=='1000') {
                            html='  <a class="btns_left " href="city.html">北京<i class="mui-icon mui-icon-arrowdown"></i></a>'+
                                    '    <a class="btns_right" href="">'+data['xingming']+'</a>'+
                                    '    <a class="btns_right " href="javascript:logout();">退出</a>'+
                                    '    <a class="btns_right " id="personalcenter" href="javascript:void(0)">个人中心</a>'+
                                    '    <a class="btns_right" href="approve.html">认证信息</a>';
                            //   html='<a class="right_teacher login-btn" href="#">'+data['xingming']+'</a><a class="right_teacher logout"  href="javascript:logout();">退出</a> <a class="right_teacher " href="approve.html">认证信息</a>';
                            $('#btns').html(html);
                            $('.logout').on('click',function(){
                                logout();
                            });
                            $('#personalcenter').on('click',function(){
                                checlogins();
                            });
                        }else{
                            alert('登录失败');
                        }
                    },
                    error:function(){

                    }
                })
                $("#login").hide();
            });
            $('#logincancel').on('click',function(){
                $("#login").hide();
            })


            checklogin();
            $('#sure').click(function(){
                var username = $('#username2').val();
                var password = $('#password2').val();
                if(null==username || ""==username){
                    mui.alert('提示', '用户名不能为空', function() {});
                    return;
                }
                if(null==password || ""==password){
                    mui.alert('提示', '密码不能为空', function() {});
                    return;
                }
                $.ajax({
                    url:url+'bangdingusername',
                    dataType:'json',
                    type:'post',
                    async:true,
                    data:{
                        'username':username,
                        'password':password
                    },
                    success:function(result){
                        // console.log(result);
                        var status = result.status;
                        var code = result.code;
                        var data = result.data;
                        var html='';
                        if(status==1&&code=='1000') {
                            alert('绑定成功');
                            window.location.href=yuming+'/index.html';
                        }else if(status==1&&code=='1010') {
                            alert('用户名不存在');
                            bangdingusername();
                        }
                    },
                    error:function(){

                    }
                })


            });
            $('#cancel').click(function(){
                $('#bangdingusername').hide();
            })
            function checlogins(){
                $.ajax({
                    url:url+'checkloginis',
                    dataType:'json',
                    type:'post',
                    async:true,
                    data:{

                    },
                    success:function(result){
                        // console.log(result);
                        var status = result.status;
                        var code = result.code;
                        var data = result.data;
                        var type = result.type;
                        var html='';
                        if(status==1&&code=='1007') {
                            if(type=='teacher'){
                                window.location.href=yuming+'/teacher.html';
                            }else if(type=='student'){
                                window.location.href=yuming+'/student.html';
                            }
                        }
                    },
                    error:function(){
                        console.log();
                    }
                });



            }
            function bangdingusername(){
                $('#bangdingusername').show();
            }

        })

    </script>
</head>

<body>
<div id="btns" style="position: absolute; z-index: 1000; color: #fff;">
    <a class="btns_left " href="city.html">北京<i class="mui-icon mui-icon-arrowdown"></i></a>
    <a class="btns_right" href="approve.html">认证</a>
    <a class="btns_right login-btn" href="#" >登录</a>
    <a class="btns_right" href="register.html">注册</a>
</div>
<div class="mui-slider">
    <div class="mui-slider-group mui-slider-loop">
    </div>
    <div class="mui-slider-indicator">
    </div>
</div>

<nav id="nav">
    <ul>
        <session id="nav_top">
            <li>
                <a href="list.html?juzhong=0"><img src="img/index/nav1.png"/>
                    <p>京剧</p>
                </a>
            </li>
            <li>
                <a href="list.html?juzhong=1"><img src="img/index/nav2.png"/>
                    <p>评剧</p>
                </a>
            </li>
            <li>
                <a href="list.html?juzhong=2"><img src="img/index/nav3.png"/>
                    <p>梆子</p>
                </a>
            </li>
            <li>
                <a href="list.html?juzhong=3"><img src="img/index/nav4.png"/>
                    <p>豫剧</p>
                </a>
            </li>
            <li>
                <a href="list.html?juzhong=6"><img src="img/index/nav5.png"/>
                    <p>越剧</p>
                </a>
            </li>
        </session>
        <session id="nav_bot">
            <li id="menuS">
                <a><img src="img/index/nav6.png"/>
                    <p>生行</p>
                </a>
            </li>
            <li id="menuD">
                <a><img src="img/index/nav7.png"/>
                    <p>旦行</p>
                </a>
            </li>
            <li id="menuJ">
                <a><img src="img/index/nav8.png"/>
                    <p>净行</p>
                </a>
            </li>
            <li id="menuC">
                <a><img src="img/index/nav9.png"/>
                    <p>丑行</p>
                </a>
            </li>
            <li id="menuQ">
                <a><img src="img/index/nav10.png"/>
                    <p>器行</p>
                </a>
            </li>
        </session>
    </ul>
</nav>
<div id="teacher">
    <h3>热门名师</h3>
    <div>
        <ul>
        </ul>
    </div>
</div>
<footer>
    <p>咨询热线：010-66011605</p>
    <p>©2017xxx xICP备14050798号-1</p>
</footer>
<!--弹框菜单开始-->
<div class="juMeun" id="menuDs" style="display:none">
    <div class="mengban meunH"></div>
    <div class="popmain">
        <div class="classTitle mui-text-center">
            生行
        </div>
        <div class="mui-subtitle">
            <a href="list.html?hangdang=老生" class="sub-window mui-text-center">
                老生
            </a>
            <a href="list.html?hangdang=小生" class="sub-window mui-text-center">
                小生
            </a>
            <a href="list.html?hangdang=娃娃生" class="sub-window mui-text-center">
                娃娃生
            </a>
            <a href="list.html?hangdang=武生" class="sub-window mui-text-center">
                武生
            </a>
            <a href="list.html?hangdang=坤生" class="sub-window mui-text-center">
                坤生
            </a>
            <a href="list.html?hangdang=红生" class="sub-window mui-text-center">
                红生
            </a>

        </div>
    </div>
</div>
<div class="juMeun" id="menuDd" style="display:none">
    <div class="mengban meunH"></div>
    <div class="popmain">
        <div class="classTitle mui-text-center">
            旦行
        </div>
        <div class="mui-subtitle">
            <a href="list.html?hangdang=青衣" class="sub-window mui-text-center">
                青衣
            </a>
            <a href="list.html?hangdang=花旦" class="sub-window mui-text-center">
                花旦
            </a>
            <a href="list.html?hangdang=花衫" class="sub-window mui-text-center">
                花衫
            </a>
            <a href="list.html?hangdang=武旦" class="sub-window mui-text-center">
                武旦
            </a>
            <a href="list.html?hangdang=老旦" class="sub-window mui-text-center">
                老旦
            </a>
            <a href="list.html?hangdang=男旦" class="sub-window mui-text-center">
                男旦
            </a>
        </div>
    </div>
</div>
<div class="juMeun" id="menuDj" style="display:none">
    <div class="mengban meunH"></div>
    <div class="popmain">
        <div class="classTitle mui-text-center">
            净行
        </div>
        <div class="mui-subtitle">
            <a href="list.html?hangdang=正净" class="sub-window mui-text-center">
                正净
            </a>
            <a href="list.html?hangdang=武净" class="sub-window mui-text-center">
                武净
            </a>
        </div>
    </div>
</div>
<div class="juMeun" id="menuDc" style="display:none">
    <div class="mengban meunH"></div>
    <div class="popmain">
        <div class="classTitle mui-text-center">
            丑行
        </div>
        <div class="mui-subtitle">
            <a href="list.html?hangdang=文丑" class="sub-window mui-text-center">
                文丑
            </a>
            <a href="list.html?hangdang=武丑" class="sub-window mui-text-center">
                武丑
            </a>
        </div>
    </div>
</div>
<div class="juMeun" id="menuDq" style="display:none">
    <div class="mengban meunH"></div>
    <div class="popmain">
        <div class="classTitle mui-text-center">
            器行
        </div>
        <div class="mui-subtitle">
            <a href="list.html?hangdang=京胡" class="sub-window mui-text-center">
                京胡
            </a>
            <a href="list.html?hangdang=月琴" class="sub-window mui-text-center">
                月琴
            </a>
            <a href="list.html?hangdang=弦子" class="sub-window mui-text-center">
                弦子
            </a>
            <a href="list.html?hangdang=单皮鼓" class="sub-window mui-text-center">
                单皮鼓
            </a>
            <a href="list.html?hangdang=大锣" class="sub-window mui-text-center">
                大锣
            </a>
            <a href="list.html?hangdang=小锣" class="sub-window mui-text-center">
                小锣
            </a>
        </div>
    </div>
</div>
<!--弹框菜单结束-->
<!--登录弹出框 start-->
<div id="login" class="disno">
    <div class="mengban"></div>
    <div class="popmain">
        <h5>登录</h5>
        <div class="meetinputs">
            <form>
                <select  class='type'>
                    <option value="">请选择自己的身份</option>
                    <option value="teacher">我是老师</option>
                    <option value="student">我是学生</option>
                </select>
                <input id="username" class="username" type="text" placeholder="输入用户名："/>
                <input id="password" class="password" type="password" placeholder="输入密码："/>
                <label>微信登录：<a href='' id="weixinhref"><img src='' style='height:40px;width:60px;border-radius: 50%;margin-bottom: -10px;margin-left: -5px;' id="weixinsrc"></a></label>
                <p id="tishi" class="disno tishi"></p>
            </form>
        </div>
        <div class="popbtns">
            <a id="logincancel" class="falseinput">取消</a>
            <a id="loginsure" class="trueinput">确定</a>
        </div>
    </div>
</div>
<!--登录弹出框 end-->
<!--绑定用户名 start-->
<div id="bangdingusername" class="disno">
    <div class="mengban"></div>
    <div class="popmain">
        <h5>请完成绑定或则注册才能完成登录</h5>
        <div class="meetinputs">
            <form>
                <input class='username' id='username2' placeholder='请输入需要绑定的用户名' type='text'>
                <input id="password2" class="password" type="password" placeholder="请输入密码："/>
                <label>还没有用户名？，<a href='"+yuming+"/register.html' id="toregister">去注册吧</a></label>
            </form>
        </div>
        <div class="popbtns">
            <a id="cancel" class="falseinput">取消</a>
            <a id="sure" class="trueinput">确定</a>
        </div>
    </div>
</div>
<!--绑定用户名 end-->
<script type="text/javascript" src='http://res.wx.qq.com/open/js/jweixin-1.2.0.js'></script>
<script type="text/javascript" src='js/indexfenxiang.js'></script>
<script type="text/javascript" src='js/fenxiang.js'></script>
</body>

</html>